package com.kordar.api.modular.unicomJS;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.util.Date;

@Data
@TableName("unicomjs_number_status")
public class ZOPNumberStatusRequestImpl implements Request {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    @NotEmpty(message = "{zop.provinceCode}{javax.validation.constraints.NotEmpty.message}")
    @Length(max = 2, min = 2, message = "{zop.provinceCode.size}")
    private String provinceCode;
    @NotEmpty(message = "{zop.cityCode}{javax.validation.constraints.NotEmpty.message}")
    @Size(max = 3, min = 3, message = "{zop.cityCode.size}")
    private String cityCode;
    @NotEmpty(message = "{zop.serialNumber}{javax.validation.constraints.NotEmpty.message}")
    private String serialNumber;
    @NotEmpty(message = "{zop.certCode}{javax.validation.constraints.NotEmpty.message}")
    private String certCode;

    private String searchType;
    private String searchValue;
    private String amounts;

    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    private String rspDesc;
    private String data;
    private String rspCode;

    /**
     * provinceCode	body	是	String		号码省分编码(3位)
     * cityCode	body	是	String		号码地市编码(2位)
     * serialNumber	body	是	String		选占号码
     * certCode	body	是	String		选占证件号码
     * @return JSONObject
     */
    @Override
    public JSONObject body() {
        JSONObject object = new JSONObject();
        object.put("provinceCode", provinceCode);
        object.put("cityCode", cityCode);
        object.put("serialNumber", serialNumber);
        object.put("certCode", certCode);
        return object;
    }

    @Override
    public String url() {
        return "http://58.240.52.214:80/jszop/zop_link/NumberStatus?secretKey=" + SysParams.SYS_SECRET_KEY.getName();
    }
}
